package com.itheima.comfyui.core.config;

import com.itheima.comfyui.core.interceptor.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

    /**
     * 添加拦截器
     * @param registry
     */
    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
       registry.addInterceptor(new UserInterceptor())
               //需要拦截的
               .addPathPatterns("/**")
               //排除的
               .excludePathPatterns("/api/1.0/user/login");
    }
}
